package com.zl.learning.guava;

import java.util.Observable;
import java.util.Observer;

public class ObservableDemo extends Observable {
    public static void main(String[] args) {
        ObservableDemo observableDemo = new ObservableDemo();
        observableDemo.addObserver(new Observer() {
            @Override
            public void update(Observable o, Object arg) {
                System.out.println("发生变化");
            }
        });
        observableDemo.addObserver(new Observer() {
            @Override
            public void update(Observable o, Object arg) {
                System.out.println("发生变化2");
            }
        });

        observableDemo.setChanged();
        observableDemo.notifyObservers();
    }
}
